#include<iostream>
using namespace std;
int main(){
	string s;
	int a;
	cin>>s>>a;
	int t1=(s[0]-'0')/a;
	int t2=(s[0]-'0')%a;
	if(t1!=0||s.size()==1)
		cout<<t1;
	if(s.size()==1){
		cout<<" "<<t2;
		return 0;
	}
	for(int i=1;i<s.size();i++){
		t1=(t2*10+s[i]-'0')/a;
		cout<<t1;
		t2=(t2*10+s[i]-'0')%a;
	}
	cout<<" "<<t2;
	return 0;
}
